home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / BMPSIZE.DMO < prev    next >
Text File  |  1996-07-04  |  4KB  |  62 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   BMPSIZE .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20. $INCLUDE "DAS-NBV1.INC"
  21.  
  22. SCREEN 12
  23. CLS
  24. GraphicSETUP
  25. COLOR 7, 0
  26.  
  27. ? "┌──────────────────────────────────────────────────────────────────────
  28. ? "│ PowerBASIC's formula for computing the number of bytes/elements that
  29. ? "│ are required to hold a bit-mapped image is a bit long so here are
  30. ? "│ some functions that will do the job for you. They all return about
  31. ? "│ the same data but how they get their input is the difference.
  32. ? "│ As their names emply, 1/2 of the functions return the exact number
  33. ? "│ of bytes required to store the image while the other 1/2 return the
  34. ? "│ number of words (2 bytes) required.
  35. ? "│ It is assumed that the incoming BitMapped data is in the same format
  36. ? "│ as is used by PowerBASIC: ie 1 word = Columns  2ed word = Rows
  37. ? "│ It is also assumed that we are working on only 1 plane (monochrome)
  38. ? "└───────────────────────────────────────────────────────────────────────
  39. ?
  40.                                          '┌────────────────────────────────
  41. Cs% = 100  : Rs% = 197                   '│ columns & rows
  42.                                          '│
  43. DIM BMParr%( Cs% )                       '│ a buffer array for fGetXArr??
  44.     BMParr%(0) = Cs%                     '│ 1st word = # of columns
  45.     BMParr%(1) = Rs%                     '│ 2ed word = # of rows
  46.                                          '│
  47. PRINT fBMPwords%    ( Cs%, Rs% )         '│ when you know the cols/rows
  48. PRINT fBMPwordsArr% ( BMParr%(0) )       '│ compute it from the array
  49. PRINT                                    '│ (same process for strings)
  50.                                          '│
  51. PRINT fBMPbytes??    ( Cs%, Rs% )        '│ ditto
  52. PRINT fBMPbytesArr?? ( BMParr%(0) )      '│
  53. PRINT                                    '│
  54.                                          '│
  55. PRINT ( 4 + CEIL( Cs% / 8 ) * 1 * Rs% )  '│ PowerBASIC's formula for 1plane
  56. PRINT                                    '│
  57.                                          '│
  58. PRINT fICONwords%  (1,1,Cs%,Rs%)         '│ these 2 come in handy when you
  59. PRINT fICONbytes?? (1,1,Cs%,Rs%)         '│ have the C1%,R1%,C2%,R2% for the
  60.                                          '│ box, you don't have to stop &
  61.                                          '│ compute the columns/rows first
  62.                                          '└──────────────────────────────────